var express = require('express');
var router = express.Router();
const { uploadFile } = require('../utils/upload.js');
const adminsApi = require('../api/admin.js');
//内置模块
const path = require("path");
const fs = require("fs");
const until = require("util");
const unlink = until.promisify(fs.unlink);
/* GET home page. */
//添加图片
router.post('/upload', async function (req, res, next) {
    const { data } = await uploadFile(req, { fileType : "usersImages", fPath : "./public" });
    const result = await adminsApi.addImg(data);
    res.send(result);
});


module.exports = router;
